package com.junzhiit.nengji.cms.web.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.junzhiit.nengji.cms.service.BenefitSettingService;
import com.junzhiit.nengji.cms.web.vo.BenefitSettingVO;
import com.junzhiit.nengji.cms.web.vo.DataTablesParamVO;
import com.junzhiit.nengji.cms.web.vo.ResultVO;

import io.swagger.annotations.ApiOperation;

@RestController
@RequestMapping("/benefit")
public class BenefitSettingController extends BaseController{

	@Autowired
	private BenefitSettingService benefitSettingService;
	
	@ApiOperation(value = "查询所有让利信息")
	@RequestMapping(method = RequestMethod.GET)
	public Map<String, Object> findAll(DataTablesParamVO dtp,BenefitSettingVO benefitSettingVO) {
		return benefitSettingService.findAll(dtp,benefitSettingVO);
	}
	
	@ApiOperation(value = "查询让利最大值")
	@RequestMapping(value="/max",method = RequestMethod.GET)
	public ResultVO findMax() {
		return benefitSettingService.getBenefitMax();
	}
	
	@ApiOperation(value = "ID查询让利信息")
	@RequestMapping(value="/find",method = RequestMethod.GET)
	public ResultVO findById(String id) {
		return benefitSettingService.findById(id);
	}
	
	@ApiOperation(value ="添加让利类别")
	@RequestMapping(value="/add",method = RequestMethod.POST)
	public ResultVO add(BenefitSettingVO benefitSettingVO) {
		return benefitSettingService.add(benefitSettingVO);
	}
	
	@ApiOperation(value="更新让利类别")
	@RequestMapping(value="/update",method=RequestMethod.PUT)
	public ResultVO update(BenefitSettingVO benefitSettingVO){
		return benefitSettingService.update(benefitSettingVO);
	}
	
	@ApiOperation(value="删除让利类别")
	@RequestMapping(value="/del",method=RequestMethod.DELETE) 
	public ResultVO delete(String id){
		return benefitSettingService.delete(id);
	}
	
}
